<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>设计癖</title>
</head>
<body>
    <button id="yjy">开始</button>
    <button id="tt">结束</button>
    <h1 id="txt">开始抽奖</h1>
    <script>
        var tag=document.getElementById('txt')
        var start=document.getElementById('yjy')
        var end=document.getElementById('tt')
        var timer;

        var list=['火箭军','第二炮兵','杨嘉扬','杨嘉扬','yjy','yjyjyjy','GAGAGAGAGAG'];    
            console.log(list[0]);
            console.log(list.length);
   start.onclick=function(){
    clearInterval(timer);
    timer=setInterval(function(){
        var n=parseInt(Math.random()*list.length);
        tag.innerHTML=list[n]
    },100)
   }
   end.onclick=function(){
                clearInterval(timer);
                tag.innerHTML=list[2]
            }
    </script>
</body>
</html>